package org.lwd.datalink.domain.media;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @Author: weidong.lin
 * @Description: 数据源类型
 * @Date: create in 2024/4/2 14:21
 */
public enum MediaSourceType {
    MYSQL, SQLSERVER, ORACLE, HDFS, FLEXIBLEQ, HBASE, ELASTICSEARCH, SDDL, ZOOKEEPER, POSTGRESQL,
    VIRTUAL, KUDU, HANA, KAFKA, DOVE, OBS;

    public boolean isRdbms() {
        if (MYSQL.equals(this) || SQLSERVER.equals(this) || ORACLE.equals(this) || POSTGRESQL.equals(this) || HANA.equals(this)) {
            return true;
        }
        return false;
    }

    public static List<MediaSourceType> getAllSrcMediaSourceTypes() {
        return Lists.newArrayList(MYSQL, SQLSERVER, HBASE, ORACLE, HANA);
    }

    public static List<MediaSourceType> getMediaSourceTypesForVirtual() {
        return Lists.newArrayList(MYSQL,SQLSERVER, HBASE, ELASTICSEARCH, SDDL);
    }

    public static List<MediaSourceType> getAllSrcTypesForIncrement() {
        return Lists.newArrayList(MYSQL, HBASE, SDDL);
    }

    public static List<MediaSourceType> getTargetTypesForRDBMS() {
        return Lists.newArrayList(MYSQL, SQLSERVER, HBASE, ELASTICSEARCH,DOVE,FLEXIBLEQ,KUDU,HDFS, OBS);
    }

    public static List<MediaSourceType> getTargetTypesForHDFS() {
        return Lists.newArrayList(MYSQL, SQLSERVER, HDFS, ELASTICSEARCH, OBS);
    }

    public static List<MediaSourceType> getTargetTypesForHBASE() {
        return Lists.newArrayList(HBASE, ELASTICSEARCH,KUDU,HDFS, OBS);
    }

    public static List<MediaSourceType> getTargetTypesForSDDL() {
        return Lists.newArrayList(MYSQL, ELASTICSEARCH);
    }

    public static List<MediaSourceType> getAllMediaSourceTypesForBidData() {
        return  Lists.newArrayList(MYSQL, SQLSERVER, HDFS, HBASE, ORACLE, HANA,ELASTICSEARCH, KUDU,POSTGRESQL,KAFKA, OBS);
    }

    public static List<String> getAllMediaSourceTypesForJob() {
        return  Lists.newArrayList(MYSQL.name(), SQLSERVER.name(), HDFS.name(), HBASE.name(),VIRTUAL.name(),
                ORACLE.name(), HANA.name(),ELASTICSEARCH.name(), KUDU.name(),POSTGRESQL.name(), OBS.name());
    }

    public static List<MediaSourceType> getMysqlTaskSrcTypes() {
        return Lists.newArrayList(MYSQL, SDDL, VIRTUAL);
    }

    public static List<MediaSourceType> getHBaseTaskSrcTypes() {
        return Lists.newArrayList(HBASE, VIRTUAL);
    }
}
